from db import db

class Users(db.Model):
    __tablename__ = 'users'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(255), unique=True, nullable=False, comment='用户名')
    password = db.Column(db.String(255), nullable=True, comment='密码')
    histories = db.relationship('History', backref='users', lazy=True)

    def __repr__(self):
        return '<User %r>' % self.name